<template>
  <div class="hello">
    <h2>这是MyVuex组件</h2>
    <h2>{{$store.state.count}}</h2>
    <button @click="add()">mutations +1</button>
  </div>
</template>

<script>
export default {
    name: 'MyVuex',
    props: {
        msg: String,
        count:Number
    },
    methods:{
        add(){
            this.$store.commit("add")
        }
    }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
    .hello {
        border: 2px solid red;
        margin:15px;
    }
</style>
